import http from '@/utils/http'
import router from '@/router/router'
export default {
    getStateInfo(context){
        //这种方法可以直接在实例中then到data的值
        return http.post('/order/admin/cmList',{})
            .then((res) => {
                if(res.status == 0 && res.code == "1000002"){
                    router.push('/login');
                }else{
                    context.commit('setStateInfo',res.data);
                }
            })
            .catch(err => console.log(err));
    },
    updateState(context,params){
        return http.post('/order/admin/detail',params)
            .then(res => {
                context.commit('setUpdateState',res.data);
            })
            .catch(err => console.log(err));
    },
    getServiceData(context,params){
        return http.post('/cmSp/admin/list',params)
            .then(res => {
                context.commit('setServiceData',res.data);
            })
            .catch(err => console.log(err));
    },
    updateOrderState(context,params){
        return http.post('/order/admin/update',params)
            .catch(err => console.log(err));
    }
}